package zjh_20230310;

import java.io.File;


public class practise04 {
    public static void main(String[] args) {
        File file = new File("D:\\kaifamiao\\code");
        double a = size(file);
        System.out.println(a);
    }

    public static double size(File file) {
        double sum = 0;
        File[] files = file.listFiles();
        for (File f : files) {
            if (f.isFile()) {
                sum += f.length();
            } else {
                sum += size(f);
            }
        }
        return sum;
    }
}
